package study.week05.gateway.outbound;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.FullHttpRequest;
import org.springframework.jms.core.JmsTemplate;
import study.week05.gateway.router.CustomRouter;

import java.util.concurrent.*;

public class OutboundHandler {

    ExecutorService proxyService;
    JmsHandler jmsHandler;

    public OutboundHandler(ExecutorService proxyService, JmsHandler jmsHandler) {
        this.proxyService = proxyService;
        this.jmsHandler = jmsHandler;
    }

    public void handleRequest(ChannelHandlerContext ctx, FullHttpRequest fullRequest){
        proxyService.execute(()->{
             //server地址通过aop注入，这里传null
             jmsHandler.sendRequest(fullRequest, ctx,null);
        });
    }




}
